package com.example.demospringmybatisplus.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.example.demospringmybatisplus.annotation.AccessLimit;
import com.example.demospringmybatisplus.processors.DataOperationService;
import com.example.demospringmybatisplus.vo.BaseDataVo;
import com.example.demospringmybatisplus.vo.SearchVo;

/**
 * 业务处理控制层
 *
 * @DATE 2024/5/3
 **/
@RestController
public class DataOperationController {

    @Autowired
    private DataOperationService dataOperationService;

    @RequestMapping("findList")
    // 设置4秒内只能访问2次
    @AccessLimit(maxCount = 2, seconds = 4)
    public List<? extends BaseDataVo> findList(@RequestBody SearchVo searchVo, @RequestParam String tableName) {
        return dataOperationService.findList(searchVo, tableName);
    }
}
